﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SR_MessageDemo { 
    public class User: INotifyPropertyChanged
    {
        private string name;
        private int age;
        private string gender;
        private string role = "非管理员";

        public string Name { get => name; set { name = value; OnNotifyPropertyChanged(nameof(Name)); } }
        public int Age { get => age; set{ age = value; OnNotifyPropertyChanged(nameof(Age)); } }
        public string Gender { get => gender; set {
                gender = value; OnNotifyPropertyChanged(nameof(Gender));
            }
        }
        public string Role { get => role; set
            {
                role = value; OnNotifyPropertyChanged(nameof(Role));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;


        public void OnNotifyPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
